package com.centling.bluecollar.login.entity;

import java.util.HashSet;  
import java.util.Set;  
  
import javax.persistence.Column;  
import javax.persistence.Entity;  
import javax.persistence.FetchType;  
import javax.persistence.GeneratedValue;  
import javax.persistence.Id;  
import javax.persistence.ManyToMany;  
import javax.persistence.Table;  
  
import org.hibernate.annotations.Cache;  
import org.hibernate.annotations.CacheConcurrencyStrategy;  
import org.hibernate.annotations.GenericGenerator;  
  
@Entity  
@Table(name = "perms", catalog = "mis2013")  
public class Perm {  
    private String id;  
    private String permname;  
    private String permtype;  
    private String permstr;  
    private Integer priority;  
    private String description;  
    private Set<Roles> roles = new HashSet<Roles>();  
  
    @Id  
    @GeneratedValue(generator = "generator")  
    @GenericGenerator(name = "generator", strategy = "uuid.hex")  
    @Column(name = "id", unique = true, nullable = false, length = 36)  
    public String getId() {  
        return id;  
    }  
  
    public void setId(String id) {  
        this.id = id;  
    }  
  
    @Column(name = "permname", nullable = false, length = 50)  
    public String getPermname() {  
        return permname;  
    }  
  
    public void setPermname(String permname) {  
        this.permname = permname;  
    }  
  
    @Column(name = "permtype", length = 15)  
    public String getPermtype() {  
        return permtype;  
    }  
  
    public void setPermtype(String permtype) {  
        this.permtype = permtype;  
    }  
  
    @Column(name = "permstr", length = 255)  
    public String getPermstr() {  
        return permstr;  
    }  
  
    public void setPermstr(String permstr) {  
        this.permstr = permstr;  
    }  
  
    @Column(name = "priority")  
    public Integer getPriority() {  
        return priority;  
    }  
  
    public void setPriority(Integer priority) {  
        this.priority = priority;  
    }  
  
    @Column(name = "description", length = 255)  
    public String getDescription() {  
        return description;  
    }  
  
    public void setDescription(String description) {  
        this.description = description;  
    }  
  
    @ManyToMany(mappedBy = "perms", targetEntity = Roles.class, fetch = FetchType.EAGER)  
    public Set<Roles> getRoles() {  
        return roles;  
    }  
  
    public void setRoles(Set<Roles> roles) {  
        this.roles = roles;  
    }  
  
}  